import java.io.*;

public class Demo5 {
    public static void main(String[] args) {
/*        try(InputStream inputStream = new FileInputStream("d:/text.txt")) {
            byte[] buffer = new byte[10];
            while (true){
                int n = inputStream.read(buffer);
                if(n == -1) break;
                for (int i = 0; i < n; i++) {
                    System.out.printf("%x\n",buffer[i]);
                }
            }
        }catch (IOException e) {
            throw new RuntimeException(e);
        }*/

        try(OutputStream outputStream = new FileOutputStream("d:/text.txt",true)){
            String s = "哈哈哈哈";
            outputStream.write(s.getBytes());
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
